<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<h2>登录</h2>
<form action="/user/loginUser" method="post">
    用户名：<input type="text" name="userName">
    密码：<input type="text" name="userPassWord">

    <button type="submit" value="登录"/>

</form>
<script src="/jquery-1.12.4.min.js">
</script>
<script>
    $(function () {

        // $.post("/user/loginUser",null,function(res){
        //
        //     alert(res);
        //
        // },json);


        $.ajax({
            url: "/user/loginUser",
            data: {},
            dataType: "json",
            type: "post",
            success: function (result) {
                alert(result.msg);
                location.href="index.html";
            },
        })
    })

</script>

</body>
</html>